Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version checks for the CLI #789

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Add version checks for the CLI #789

wants to merge 2 commits into from

Conversation

SferaDev
Copy link
Member

@SferaDev SferaDev commented Nov 25, 2022

Make sure the CLI and codegen use the same version or a semver compatible one.

Criteria:

  • Projects should NOT have a pinned codegen version.
  • Users should always be in the latest CLI version.
  • Codegen breaking changes should be avoided, and only happening in major version releases.

@SferaDev SferaDev requested a review from a team as a code owner November 25, 2022 08:19
@changeset-bot
Copy link

changeset-bot bot commented Nov 25, 2022

🦋 Changeset detected

Latest commit: 355c9c3

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "@xata.io/client" specified in the `linked` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.
The package or glob expression "@xata.io/codegen" specified in the `linked` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2022

size-limit report 📦

Path Size
packages/client/dist/index.mjs 14.1 KB (0%)
packages/client/dist/index.cjs 15.19 KB (+0.04% 🔺)
packages/codegen/dist/index.mjs 3.11 MB (0%)
packages/codegen/dist/index.cjs 3.11 MB (0%)

@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2022

Your pull request has been published to npm.

You can install it by running:

npm install @xata.io/[email protected]

To test the CLI, run:

npx @xata.io/[email protected]

Signed-off-by: Alexis Rico <[email protected]>

if (!semver.satisfies(installedVersion, `^${sdkVersion}`)) {
return this.error(
`The installed version of @xata.io/client (${installedVersion}) does not satisfy the required version (${sdkVersion}). Please update your package.json.`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`The installed version of @xata.io/client (${installedVersion}) does not satisfy the required version (${sdkVersion}). Please update your package.json.`
`The installed version of the SDK (${installedVersion}) does not satisfy the CLI version (${sdkVersion}). Please update the packages to run the codegen.`

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to:

  • If SDK is outdated, offer to update it with a question
  • If CLI is outdated, show command to update (or when we have auto update, offer to update it with a question)

Also:

  • Add --force to ignore the errors and continue if user knows what they're doing

@SferaDev SferaDev marked this pull request as draft November 25, 2022 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant